<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="业务单打印" />
<%@ include file="../inc/PrintTitle.jsp"%>
<head>
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doPrint(){
		ShowConfirm('确认框','确定开始打印吗？',340,80,"doPrintCallBack()");
	}
	function doPrintCallBack(){
		if(popRetVal!=null){
			document.getElementById("noPrinSpan").style.display="none";
			doPrintLog();
		}
	}
	function doPrintLog(){
		var xmlHttp=createXMLHttpRequest();
		xmlHttp.open("GET", "/business/BusinessBillLabelLog.ihtm?id=${record.businessBill.id}&item_id_str=${itemIdStr}");
		xmlHttp.onreadystatechange = function(){callback(xmlHttp)};
		xmlHttp.send(null);
	}
	function callback(xmlHttp){
		if (xmlHttp.readyState == 4) {
	  		if (xmlHttp.status == 200) {
	  			var resTxt=xmlHttp.responseText;
	  			if(resTxt=="NO_LOGIN"){
	  				ShowAlert('提示框','你还没登录或已经超时，请重新登录。',200,100);
	  			}else if(resTxt=="OK"){
	  				printContent("管理易-条形码","${enterpriseInfo.doPrint}","${enterpriseInfo.printWidth}",240);
	  			}
	  			document.getElementById("noPrinSpan").style.display="";
			}
		}
	}
	function doCancel(){
		window.close();
	}
</script>
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/jquery-barcode.js"></script>
<script language="javascript">
	var settings = {
			output: "css",
          	showHRI: false,
          	bgColor: "#FFFFFF",
      		color: "#000000",
            fontSize: 9,			
          	barWidth: 1,
          	barHeight: 30
	};
	//var btype="code39";
	var btype="code128";
	function showBarcode(value,objName){
		$("#"+objName).html("").show().barcode(value, btype, settings);
	}
</script>
</head>
<body style="background-color:#FFFFFF">
<c:forEach var="item" items="${record.items}" varStatus="bi">
<c:if test="${bi.index>0}"><div class='PageNext'>&nbsp;</div></c:if>
<div style="height:4px">&nbsp;</div>
<table width="230" align="center" border="1" cellspacing="2" cellpadding="2" class="label_table">
	<tr>
		<td>
			<table width="100%" align="center" border="0" cellspacing="0" cellpadding="0" class="label_table">
		        <tr> 
		          <td align="center"><div id="barcodeTarget${bi.index}"></div></td>
		        </tr>
		        <tr> 
		          <td align="center" class="FontMedium" >${record.businessBill.billCode}</td>
		        </tr>
		        <tr> 
		          <td class="FontMedium"><b>制作：</b><commonTag:cutString source="${record.clientName}" subLength="26" appendString="..." /></td>
		        </tr>
		        <tr> 
		          <td class="FontMedium"><b>项目：</b><commonTag:cutString source="${item.makeTypeName}" subLength="26" appendString="..." /></td>
		        </tr>
		        <tr> 
		          <td class="FontMedium"><b>内容：</b><commonTag:cutString source="${item.businessBillItem.finishedContent}" subLength="26" appendString="..." /></td>
		        </tr>
		        <tr> 
		          <td class="FontMedium"><b>材质：</b><commonTag:cutString source="${item.businessBillItem.proName}" subLength="26" appendString="..." /></td>
		        </tr>
		        <tr> 
		          <td class="FontMedium"><b>规格：</b><commonTag:parseEnterToBr source="${item.businessBillItem.specification}" /><c:if test="${item.businessBillItem.priceType=='AREA' || item.businessBillItem.priceType=='LENGTH'}"> x <commonTag:parseBigDecimal source="${item.businessBillItem.amount}" /></c:if></td>
		        </tr>
		        <tr> 
		          <td class="FontMedium"><b>数量：</b><c:if test="${item.businessBillItem.priceType=='AREA' || item.businessBillItem.priceType=='LENGTH'}"><commonTag:parseBigDecimal source="${item.businessBillItem.squareNum}" /></c:if><c:if test="${item.businessBillItem.priceType=='AMOUNT'}"><commonTag:parseBigDecimal source="${item.businessBillItem.amount}" /></c:if><c:if test="${item.businessBillItem.priceType=='AREA'}">平方米</c:if><c:if test="${item.businessBillItem.priceType=='LENGTH'}"><c:if test="${item.businessBillItem.lengType=='M'}">米</c:if><c:if test="${item.businessBillItem.lengType=='CM'}">公分</c:if></c:if><c:if test="${item.businessBillItem.priceType=='AMOUNT'}">${item.businessBillItem.unit}</c:if>
				  &nbsp;<b>本次数量：</b>
				  </td>
		        </tr>
		        <tr> 
		          <td class="FontMedium"><b>打印：</b><fmt:formatDate value="${now}" pattern="yyyy-MM-dd HH:mm"/> ${currentUser.staffer.stafferName}</td>
		        </tr>
		      </table>
		</td>
	</tr>
</table>
<script language="javascript">
	showBarcode('${record.businessBill.billCode}','barcodeTarget${bi.index}');
</script>
</c:forEach>
<table width="230" border="0" cellspacing="1" cellpadding="1" align="center" id="noPrinSpan">
	<tr>
		<td align="center" height="10">
			&nbsp;
		</td>	
	</tr>	
	<tr>
		<td align="center">
			<input type="button" id="printButton" class="Button" value="开始打印" onClick="doPrint();">
			<input type="button" id="cancelButton" class="Button" value=" 退 出 " onClick="doCancel();">
		</td>
	</tr>
</table>
</body>
</html>
